home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-26 | 2.1 KB | 85 lines | [TEXT/KAHL] |
- * ***
- * Methods for a system error notifier
- *
- * Julian Barkway (c) October 1994. All rights reserved.
- *
- * v3.1.3 Initial release.
- *
- * ***
- Class Notifier Object nWindow pMenu theText
-
- "Process::trace modified to write results to a string"
-
- Methods Process 'tracing'
- traceToMem | link m r s |
- " first yield scheduler, forcing store of linkPointer"
- scheduler yield.
- linkPointer isNil ifTrue: [
- ^ 'No trace-back data available'
- ].
- link <- linkPointer.
- link <- stack at: link + 1.
- s <- ''.
- " then trace back chain "
- [ link notNil ] whileTrue: [
- m <- stack at: link + 3.
- m notNil ifTrue: [
- s <- s , (m signature) , ' ( '.
- r <- stack at: link + 2.
- (r to: link-1) do: [:x |
- s <- s, ((stack at: x) class asString), ' '
- ].
- s <- s, ')', newLine
- ].
- link <- stack at: link
- ].
- ^ s
- ]
-
- Methods Smalltalk 'doit'
- error: aString | s txt |
- " print a message, and remove current process "
- txt <- scheduler currentProcess traceToMem.
- Notifier new; notify: aString withText: txt.
- (scheduler currentProcess) terminate
- ]
-
- Methods Notifier 'all'
- notify: titleText withText: text
- theText <- text.
- self makeWindow: titleText
- |
- makeWindow: aTitle
- | maxW maxH topCentre origin |
- maxW <- (smalltalk getMaxScreenArea) right.
- maxH <- (smalltalk getMaxScreenArea) bottom.
- topCentre <- (0@0).
- origin <- (0@0).
- topCentre x: ((maxW / 2) truncated); y: 150.
- origin <- topCentre - (175@0).
- maxW <- 350 min: ((origin x) + (maxW - 70)).
- maxH <- 100 min: ((origin y) + (maxH - 70)).
- nWindow <- Window new;
- title: aTitle;
- openAt: origin withSize: (maxW@maxH).
- self makePane
- |
- makePane | ww wh |
- self makePopMenu.
- ww <- (nWindow size) x + 1.
- wh <- (nWindow size) y + 1.
- thePane <- TextPane new;
- boundsFrom: (-1 @ -1) to: (ww @ wh);
- attachTo: nWindow withSizing: (1 @ 1) andLineLength: (80 * 9);
- font: 'monaco'; fontSize: 9; print: theText;
- button2Action: [:p | pMenu popUpAt: p ]
- |
- makePopMenu
- pMenu <- PopUpMenu new; create.
- pMenu addItem: 'Close'
- action: [ nWindow close ];
- addItem: 'Debug'
- action: [ ^ nil ];
- disableItem: 2
- ]
-